import Vue from "vue";
import VueRouter from "vue-router";
import AppIndex from "../components/AppIndex";
import Home from "../components/Home";
import LibraryIndex from "../components/library/LibraryIndex";
import Blog from "../components/blog/Blog";
import ShowBook from "../components/library/ShowBook";
import BookInfo from "../components/library/BookInfo";
import Login from "../components/admin/Login";
import admin from "@/components/admin/admin.vue";
import info from "@/components/admin/info.vue";
import collect from "@/components/admin/mycollect.vue";
import myarticle from "@/components/admin/myarticle.vue";
import Collect from "@/components/collect/collect.vue";
import Author from "@/components/author/author.vue";
import AuthorIndex from "@/components/author/authorIndex.vue";
import Article from "@/components/author/article.vue";
import AuthorPresent from "@/components/author/create.vue";
import AuthorStar from "@/components/author/authorStar.vue";
import Study from "@/components/author/Study.vue";
import Need from "@/components/author/Need.vue";
import Present from "@/components/author/Present.vue"
import Create from "@/components/author/create.vue";
import Book from "@/components/author/createBook.vue"

Vue.use(VueRouter)


export default new VueRouter({
    routes:[
        {
            path:'/home',
            name:'Home',
            component:Home,
            redirect:'/index',
            children:[
                {
                    path:'/index',
                    name:'AppIndex',
                    component:AppIndex,
                },
                {
                    path:'/library',
                    name:'Library',
                    component:LibraryIndex,
                },
                {
                    path:'/collect',
                    name:'Collect',
                    component:Collect,
                },
                {
                    path:'/authorIndex',
                    name:'AuthorIndex',
                    component:AuthorIndex,
                    redirect:'/authorIndex/author',
                    children:[
                        {
                            path:'/authorIndex/author',
                            name:'Author',
                            component:Author,
                        },
                        {
                            path:'/authorIndex/article/:id/',
                            name:'Article',
                            component:Article,
                        },
                        {
                            path:'/authorIndex/authorPresent/one',
                            name:'AuthorStar',
                            component:AuthorStar,
                        },
                        {
                            path:'/authorIndex/authorPresent/two',
                            name:'Present',
                            component:Present,
                        },
                        {
                            path:'/authorIndex/authorPresent/three',
                            name:'Study',
                            component:Study,
                        },
                        {
                            path:'/authorIndex/authorPresent/four',
                            name:'Need',
                            component:Need,
                        },
                        {
                            path:'/authorIndex/create',
                            name:'Create',
                            component:Create,
                        },
                        {
                            path:'/authorIndex/create/book/:id/',
                            name:'Book',
                            component:Book,
                        },
                    ]
                },
                {
                    path:'/blog',
                    name:'Blog',
                    component:Blog
                },
                {
                    path:'/showBook',
                    name:'ShowBook',
                    component:ShowBook
                },
                {
                    path:'/book/:id/',
                    name:'BookInfo',
                    component:BookInfo
                },
                {
                    path:'/admin',
                    name:'admin',
                    component:admin,
                    children:[
                        {
                            path:'/admin/info',
                            name:'info',
                            component:info,
                        },
                        {
                            path:'/admin/mycollect',
                            name:'mycollect',
                            component:collect,
                        },
                        {
                            path:'/admin/myarticle',
                            name:'myarticle',
                            component:myarticle,
                        },
                    ]
                },
            ]
        },
        {
            path:'/login',
            name:'login',
            component:Login,
        },
        {
            path: '/',
            redirect: '/login'
        }
    ]
})